package com.edais.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.edais.domain.AppVersionInfo;
import com.edais.domain.Bank;
import com.edais.domain.IdcardInfo;
import com.edais.domain.PushSetting;
import com.edais.domain.UserRecePayCard;
import com.edais.domain.ViewFeedBack;
import com.edais.domain.sina.City;
import com.edais.domain.sina.Province;
import com.edais.persistence.OptionMapper;

@Repository

public class OptionDao {
	@Autowired
	private OptionMapper optionMapper;

	/**
	 * 绑定手机号（用户信息表）
	 * 
	 * @return
	 */
	public void setPhoneno(String phoneNo, String id) throws Exception {
		this.optionMapper.setPhoneno(phoneNo, id);

	}

	/**
	 * 绑定手机号（用户主表）
	 * 
	 * @return
	 */
	public void modifyMobileValidate(String validate, String mobile, String id)
			throws Exception {
		this.optionMapper.modifyMobileValidate(validate, mobile, id);
	}

	/**
	 * 设置回款卡号
	 * 
	 * @return
	 */
	public void setIsRecePayCard(UserRecePayCard userRecePayCard)
			throws Exception {
		this.optionMapper.setIsRecePayCard(userRecePayCard);
	}

	/**
	 * 根据id查询银行基本信息
	 * 
	 * @return
	 */
	public List<Bank> getBankDetail(Map<String,Object> map) throws Exception {
		return this.optionMapper.getBankDetail(map);
	}

	/**
	 * 根据应用版本号、操作系统查询该版本的信息
	 * 
	 * @param appVersion
	 *            应用版本号
	 * @param osName
	 *            操作系统
	 * @return
	 * @throws Exception
	 */
	public AppVersionInfo getAppVersionInfoCurrent(String appVersion,
			String osName) throws Exception {
		return this.optionMapper.getAppVersionInfoCurrent(appVersion, osName);
	}

	/**
	 * 根据操作系统查询最新版本的信息
	 * 
	 * @param osName
	 *            操作系统
	 * @return
	 * @throws Exception
	 */
	public AppVersionInfo getAppVersionInfoNew(String osName) throws Exception {
		return this.optionMapper.getAppVersionInfoNew(osName);
	}

	/**
	 * 获取两个版本之间更新类型最大值：1-无需升级，2-可选升级,3-必须升级
	 * 
	 * @param idCurrent
	 *            当前版本号
	 * @param idNew
	 *            最新版本号
	 * 
	 * @return
	 * @throws Exception
	 */
	public String getAppVersionUpdateType(String osName,
			String idCurrent, String idNew) throws Exception {
		return this.optionMapper.getAppVersionUpdateType(osName, idCurrent,
				idNew);
	}
	
	public void updateIdCardValidate(String validate,String allowLend,String belenderTime, String id) throws Exception{
		optionMapper.updateIdCardValidate(validate,allowLend,belenderTime,id);
	}
	
	public void insertIdCardInfo(IdcardInfo idCardInfo) throws Exception{
		optionMapper.insertIdCardInfo(idCardInfo);
	}
	public void insertView(ViewFeedBack viewMsg) throws Exception{
		optionMapper.insertView(viewMsg);
	}
	
	public String getThemeId(String key) throws Exception{
		return optionMapper.getThemeId(key);
	}
	
	public void setPushSwitchOn(String switchFlg1,String userId,String switchFlg2,String themeId) throws Exception{
		optionMapper.setPushSwitchOn(switchFlg1, userId, switchFlg2, themeId);
	}
	
	public void setPushSwitchOff(String userId, String themeId,String switchFlg1,String switchFlg2) throws Exception{
		optionMapper.setPushSwitchOff(userId, themeId, switchFlg1, switchFlg2);
	}
	
	public List<PushSetting> getSettingStus(Map<String, Object> map) throws Exception{
		return optionMapper.getSettingStus(map);
	}
	
	public List<Province> getProvinces() throws Exception{
		return optionMapper.getProvinces();
	}
	
	public List<City> getCitys() throws Exception{
		return optionMapper.getCitys();
	}
	
	public Province getProvinceById(String provinceId) throws Exception{
		return optionMapper.getProvinceById(provinceId);
	}
	
	public City getCityById(String cityId) throws Exception{
		return optionMapper.getCityById(cityId);
	}
	
	public Bank getBankCodeById(Map<String, String> map) throws Exception{
		return optionMapper.getBankCodeById(map);
	}
	
	public void addPayCard(UserRecePayCard userRecePayCard) throws Exception{
		optionMapper.addPayCard(userRecePayCard);
	}
	
	public UserRecePayCard getBankCardId(UserRecePayCard userRecePayCard) throws Exception{
		return optionMapper.getBankCardId(userRecePayCard);
	}
	
	public void updateBankCardInfo(Map<String, String> map) throws Exception{
		optionMapper.updateBankCardInfo(map);
	}
	
	public String getSinaBindingReqSeqSeq() throws Exception{
		return optionMapper.getSinaBindingReqSeqSeq();
	}
	
	public void modifyPayPwd(Map<String, String> map) throws Exception{
		optionMapper.modifyPayPwd(map);
	}
	
	public void addLoanApplication(Map<String, String> map) throws Exception{
		optionMapper.addLoanApplication(map);
	}
	
	public List<City> getCityByProvince(String provinceId){
		return optionMapper.getCityByProvince(provinceId);
	}
	
	public City getCityByCode(String cityCode){
		return optionMapper.getCityByCode(cityCode);
	}
	
}
